#include <iostream>
using namespace std;
const int N = 1e6+5;
typedef long long ll ; 
int a[N];
ll rd(){
	ll a;
	scanf("%ld",&a);
	return a;
}
int main(){
	ll n,k;
	n=rd();k=rd();
	for(int i=1;i<=n;i++){
		a[i]=rd();
		a[i]=a[i]+a[i-1];
	}//前缀和 
	ll m,max=0;
	for(int j=1;j<=n-k;j++){//0<=k<=n-1 
		m=a[j+k]-a[j-1];
		if(m>max) max=m; 
	}
	printf("%ld",max);
	return 0;
}